package com.gisterrier.shared;

import java.io.Serializable;

public class ClSelection implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8256192795699015285L;

	private int type;
	private String sql;
	private int parenttype;

	public static final int T_NONE = -1;
	public static final int T_REGION = 1;
	public static final int T_SUBREGION = 2;
	public static final int T_CITY = 3;
	public static final int T_STREET = 4;
	public static final int T_BUILDING_TYPE = 5;
	public static final int T_CUST_BUISNESS = 6;
	public static final int T_CUST_TYPE = 7;
	public static final int T_CUST_STATUS = 8;
	public static final int T_CUST_CLASS = 9;
	public static final int T_TARIF_PLAN = 10;
	public static final int T_CUST_SCOPE = 11;
	public static final int T_GAS_PRESS = 12;
	public static final int T_CUST_LOG_TYPE = 13;

	public static final ClSelection[] SELECTIONS = new ClSelection[] {
			new ClSelection(
					T_REGION,
					"select ppcityid id,ppcityname cvalue from ppcity order by 2",
					T_NONE),
			new ClSelection(
					T_SUBREGION,
					"select pcityid id,pcityname cvalue, ppcityid parentId from pcity  order by 3, 2",
					T_REGION),
			new ClSelection(
					T_CITY,
					"select cityid id,cityname cvalue, pcityid parentId from city  order by 3, 2",
					T_SUBREGION),
			new ClSelection(
					T_STREET,
					"select streetid id,streetname cvalue, cityid parentId from street order by 3, 2",
					T_CITY),
			new ClSelection(
					T_BUILDING_TYPE,
					"select 0 id, 'კორპუსი' cvalue union all select 1 , 'კერძო' cvalue",
					T_NONE),
			new ClSelection(
					T_CUST_BUISNESS,
					"select id,\"name\" cvalue from customer_business order by 1",
					T_NONE),
			new ClSelection(
					T_CUST_TYPE,
					"select custypeid id,custypename cvalue from custype order by 1",
					T_NONE),
			new ClSelection(
					T_CUST_STATUS,
					"select cusstatusid id,cusstatusname cvalue from cusstatus order by 1",
					T_NONE),
			new ClSelection(T_CUST_CLASS,
					"select  id,classname cvalue from cusclass order by 1",
					T_NONE),
			new ClSelection(
					T_TARIF_PLAN,
					"select 0 id, '2008/04/30მდე' cvalue union all select 1 , '2008/0501დან' cvalue",
					T_NONE),
			new ClSelection(
					T_CUST_SCOPE,
					"select  id,\"name\" cvalue from customer_scope order by 1",
					T_NONE),
			new ClSelection(T_GAS_PRESS,
					"select  id,pressname cvalue from gasspress order by 1",
					T_NONE),
			new ClSelection(
					T_CUST_LOG_TYPE,
					"select  id,\"name\" cvalue from customer_log_type order by 1",
					T_NONE)

	};

	public ClSelection() {

	}

	public ClSelection(int type, String sql, int parenttype) {
		this.type = type;
		this.sql = sql;
		this.parenttype = parenttype;
	}

	public int getType() {
		return type;
	}

	public String getSql() {
		return sql;
	}

	public int getParenttype() {
		return parenttype;
	}

}
